package com.ferryc.controller;

import com.ferryc.entity.Account;
import com.ferryc.exception.HandleException;
import com.ferryc.exception.NSFException;
import com.ferryc.mapper.AccountMapper;
import com.ferryc.model.Result;
import com.ferryc.tcc.IAccountTccService;
import com.ferryc.utils.DigitalUtils;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.bytesoft.compensable.Compensable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by Ferry Chen on 2019/11/18.
 */
@RestController
@RequestMapping("/tcc")
public class AccountTccController  {

    @Autowired
    private IAccountTccService accountTccService;


    @PostMapping("/consume")
    public Result consume(@RequestParam(value = "userId") String userId,
                          @RequestParam(value = "money") Double money) {
        accountTccService.consume(userId, money);
        return Result.success("ok");
    }


}
